package enterprise.manage.entity;

import javax.persistence.*;
import java.util.Calendar;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2012-11-20
 * Time: 21:23:24
 * desc:采购记录表
 */
@Entity
@Table(schema = "mg", name = "purchase_info")
public class Purchases {
    private Long id;
    /**
     * 单价
     */
    private Double price;
    /**
     * 数量
     */
    private Long quantity;
    /**
     * 采购人Id     userId
     */
    private User user;
    /**
     * 采购日期
     */
    private Calendar purchaseTime;
    /**
     * 处理人 handlerId
     */
    private User handler;
    /**
     * 产品 截止日期 （保质期）
     */
    private Calendar deadlines;
    /**
     * 创建时间
     */
    private Calendar createTime;
    /**
     * 删除标志
     */
    private int delFlag;
    /**
     * 是否入库
     */
    private int status;
    /**
     * 备注
     */
    private String remark;
    /**
     * 采购流水号 
     */
    private String purchaseNo;
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Long getQuantity() {
        return quantity;
    }

    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }


    public int getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(int delFlag) {
        this.delFlag = delFlag;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
    @ManyToOne(cascade = {CascadeType.REFRESH},fetch = FetchType.LAZY)
    @JoinColumn(name = "userId")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Calendar getPurchaseTime() {
        return purchaseTime;
    }

    public void setPurchaseTime(Calendar purchaseTime) {
        this.purchaseTime = purchaseTime;
    }
    @ManyToOne(cascade = {CascadeType.REFRESH},fetch = FetchType.LAZY)
    @JoinColumn(name = "handlerId")
    public User getHandler() {
        return handler;
    }

    public void setHandler(User handler) {
        this.handler = handler;
    }

    public Calendar getDeadlines() {
        return deadlines;
    }

    public void setDeadlines(Calendar deadlines) {
        this.deadlines = deadlines;
    }

    public Calendar getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Calendar createTime) {
        this.createTime = createTime;
    }

    public String getPurchaseNo() {
        return purchaseNo;
    }

    public void setPurchaseNo(String purchaseNo) {
        this.purchaseNo = purchaseNo;
    }
}
